package Code.Day9_20240926.com.dx.day09;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName Test03
 * @Description Map 键值对
 * @Author 12994
 * @Date 2024/9/26 16:20
 * @Version 1.0
 **/
public class Test03 {
    public static void main(String[] args) {
        // 表号, 表值
        Map<String, Double> map = new HashMap<>();
        map.put("D1_W_A003", 10000D);
        map.put("D1_W_G003", 10002D);
        map.put("D1_W_B003", 10001D);

        //集合长度
        System.out.println(map.size());

        map.forEach((k, v) -> {
            System.out.println(k + "->" + v);
        });

        System.out.println(map.get("D1_W_A003"));
        map.remove("D1_W_A003");

        map.forEach((k, v) -> {
            System.out.println(k + ": " + v);
        });
        for (String k : map.keySet()) {
            System.out.println(k + "->" + map.get(k));
        }
    }
}
